﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Companies.aspx.cs" Inherits="Admin_Companies"  MasterPageFile="~/Site.master"%>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<br />
    <asp:HyperLink ID="AdminCompaniesLink1" NavigateUrl="../Admin/Admin.aspx" runat="server">Администраторская панель</asp:HyperLink>
&nbsp;&nbsp;
    
    → &nbsp;
    <b><asp:Label ID="AdminCompaniesLink2" runat="server" ForeColor="black" Text="База предприятий"></asp:Label></b>
    <br />
    <br />
    <asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
        AutoGenerateColumns="False" DataKeyNames="CompanyId" 
        DataSourceID="SqlDataSourceCompanies" 
        onselectedindexchanged="GridView1_SelectedIndexChanged" AllowPaging="True">
        <Columns>
            <asp:CommandField SelectText="Выбрать" ShowSelectButton="True" />
            <asp:BoundField DataField="Название" HeaderText="Название" 
                SortExpression="Название" />
            <asp:BoundField DataField="Дата создания" HeaderText="Дата создания" 
                SortExpression="Дата создания" />
            <asp:BoundField DataField="Организационная форма" 
                HeaderText="Организационная форма" SortExpression="Организационная форма" />
            <asp:BoundField DataField="Размер" HeaderText="Размер" 
                SortExpression="Размер" />
            <asp:BoundField DataField="Вид деятельности" HeaderText="Вид деятельности" 
                SortExpression="Вид деятельности" />
            <asp:BoundField DataField="CompanyId" HeaderText="CompanyId" 
                InsertVisible="False" ReadOnly="True" SortExpression="CompanyId" 
                Visible="False" />
        </Columns>
    </asp:GridView>

    <asp:SqlDataSource ID="SqlDataSourceCompanies" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BankDBConnectionString %>" 
        SelectCommand="SELECT Company.CompanyName AS Название, Company.CreationDate AS [Дата создания], OrganizationalForm.Name AS [Организационная форма], CompanySize.Name AS Размер, Activity.Name AS [Вид деятельности], Company.CompanyId FROM Activity INNER JOIN Company ON Activity.CompanyActivityId = Company.ActivityId INNER JOIN CompanySize ON Company.CompanySizeId = CompanySize.CompanySizeId INNER JOIN OrganizationalForm ON Company.OrganitionalFormId = OrganizationalForm.CompanyOrganizationalFormId">
    </asp:SqlDataSource>

<br />
    <asp:Button ID="AddNewCompanyButton" runat="server" 
        Text="Добавить новое предприятие" onclick="AddNewCompanyButton_Click" />
</asp:Content>